﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace GameObjects
{
    public class PlayerMove : GameObjects.IMovable
    {
        private Vector2 _position;
        private float _speed;

        public Vector2 Position
        {
            get
            {
                return _position;
            }
            set
            {
                _position = value;
            }
        }
        public float Speed
        {
            get
            {
                return _speed;
            }
            set
            {
                _speed = value;
            }
        }

        public void Move()
        {
            KeyboardState keyboardState = Keyboard.GetState();
            if (keyboardState.IsKeyDown(Keys.Left))
                _position.X -= _speed;
            if (keyboardState.IsKeyDown(Keys.Right))
                _position.X += _speed;
            if (keyboardState.IsKeyDown(Keys.Up))
                _position.Y -= _speed;
            if (keyboardState.IsKeyDown(Keys.Down))
                _position.Y += _speed;
        }
    }
}
